package com.ruoyi.web.controller.system;

import java.util.List;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.ArAuthenticate;
import com.ruoyi.system.service.IArAuthenticateService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 鉴定规则信息Controller
 * 
 * @author ruoyi_hsl
 * @date 2022-03-17
 */
@RestController
@RequestMapping("/system/authenticate")
public class ArAuthenticateController extends BaseController
{
    @Autowired
    private IArAuthenticateService arAuthenticateService;

    /**
     * 查询鉴定规则信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:authenticate:list')")
    @ApiOperation("查询鉴定规则信息列表")
    @GetMapping("/list")
    public TableDataInfo list(ArAuthenticate arAuthenticate)
    {
        startPage();
        List<ArAuthenticate> list = arAuthenticateService.selectArAuthenticateList(arAuthenticate);
        return getDataTable(list);
    }

    /**
     * 导出鉴定规则信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:authenticate:export')")
    @Log(title = "鉴定规则信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ArAuthenticate arAuthenticate)
    {
        List<ArAuthenticate> list = arAuthenticateService.selectArAuthenticateList(arAuthenticate);
        ExcelUtil<ArAuthenticate> util = new ExcelUtil<ArAuthenticate>(ArAuthenticate.class);
        return util.exportExcel(list, "authenticate");
    }

    /**
     * 获取鉴定规则信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:authenticate:query')")
    @ApiOperation("获取鉴定规则信息详细信息")
    @ApiImplicitParam(name = "recNo", value = "鉴定规则编号", required = true, dataType = "String", paramType = "传鉴定规则编号")
    @GetMapping(value = "/{recNo}")
    public AjaxResult getInfo(@PathVariable("recNo") String recNo)
    {
        return AjaxResult.success(arAuthenticateService.selectArAuthenticateById(recNo));
    }

    /**
     * 新增鉴定规则信息
     */
    @PreAuthorize("@ss.hasPermi('system:authenticate:add')")
    @Log(title = "鉴定规则信息", businessType = BusinessType.INSERT)
    @ApiOperation("新增鉴定规则信息")
    @ApiImplicitParam(name = "arAuthenticate", value = "鉴定规则对象", required = true, dataType = "ArAuthenticate", paramType = "传鉴定规则对象")
    @PostMapping
    public AjaxResult add(@RequestBody ArAuthenticate arAuthenticate)
    {
        return toAjax(arAuthenticateService.insertArAuthenticate(arAuthenticate));
    }

    /**
     * 修改鉴定规则信息
     */
    @PreAuthorize("@ss.hasPermi('system:authenticate:edit')")
    @Log(title = "鉴定规则信息", businessType = BusinessType.UPDATE)
    @ApiOperation("修改鉴定规则信息")
    @ApiImplicitParam(name = "arAuthenticate", value = "鉴定规则对象", required = true, dataType = "ArAuthenticate", paramType = "传鉴定规则对象")
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody ArAuthenticate arAuthenticate)
    {
        return toAjax(arAuthenticateService.updateArAuthenticate(arAuthenticate));
    }

    /**
     * 删除鉴定规则信息
     */
    @PreAuthorize("@ss.hasPermi('system:authenticate:remove')")
    @Log(title = "鉴定规则信息", businessType = BusinessType.DELETE)
    @ApiOperation("删除鉴定规则信息")
    @ApiImplicitParam(name = "recNos", value = "鉴定规则编号数组", required = true, dataType = "String[]", paramType = "传鉴定规则编号数组")
    @GetMapping("/remove/{recNos}")
    public AjaxResult remove(@PathVariable String[] recNos)
    {
        return toAjax(arAuthenticateService.deleteArAuthenticateByIds(recNos));
    }
}
